package com.linln.modules.system.config;

import org.apache.commons.dbcp2.BasicDataSource;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.sql.DataSource;

/**
 * @author WuKai
 * @date 2021/6/16 9:40
 */
@Configuration
public class DataSourceConfig {
    @Bean("myDbcp2DataSource")
    @ConfigurationProperties(prefix = "spring.datasource")
    public DataSource getDataSource(){
        return DataSourceBuilder.create().type(BasicDataSource.class).build();
    }
}
